<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('承办单位处理中')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form">
                <div class="select-list">
                    <ul>
                        <li>
                            工单编号：<input type="text" name="workFormNo"/>
                        </li>
                        <li>
                            来电人名：<input type="text" name="fromName"/>
                        </li>

                        <li>
                            地区名称：<input type="text" name="fmAreaName"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm " id="toolbar" role="group">
            <a class="btn btn-success multiple disabled" onclick="tWFormUpdate()"
               shiro:hasPermission="mTelRcd:process:view">
                <i class="fa fa-plus"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="sendBack()">
                <!--                TODO 是否要权限验证-->
                <i class="fa fa-remove"></i> 撤回
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "system/mTelWF";

    $(function () {
        var options = {
            url: prefix + "/rManage/sendOverListJson",
            updateUrl: prefix + "/cmnFile/sendBackList/{id}",
            detailUrl: "/system/test/caseDetail/{id}",
            removeUrl: prefix + "/remove",
            sortName: "pkId",
            sortOrder: "desc",
            uniqueId: "pkId",
            modalName: "承办单位处理中",
            fixedColumns: true,
            fixedNumber: 2,
            fixedRightNumber: 1,
            columns: [{
                checkbox: true
            },
                {field: 'pkId', title: 'pkid', id: 'pkId', visible: false},
                {field: 'getDealPK', title: 'getDealPK', visible: false},
                {field: 'wfId', title: 'wfId', visible: false},
                {field: 'workFormNo', title: '工单编号', align: 'left', halign: 'center', sortable: true},
                {
                    field: 'setProId', title: '性质', align: 'center', formatter: function (value, row, index) {
                        return fmtWFormSort(value, row, index);
                    }
                },
                {field: 'wsTopic', title: '主题', align: 'left', halign: 'center', sortable: true},
                {field: 'fmAreaName', title: '属地', align: 'left', halign: 'center', sortable: true},
                {field: 'fromName', title: '来电人', align: 'center', sortable: true},
                {field: 'fromTelA', title: '来电号码', align: 'center', sortable: true},
                {field: 'dfmClaName', title: '诉求类别', align: 'center', sortable: true},
                {field: 'iptTime', title: '创建时间', align: 'center', sortable: true},
                {
                    field: 'openFrom',
                    title: '公开',
                    align: 'center',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return fmtWFormOpen(value, row, index);
                    }
                },
                {field: 'lmtDate', title: '办理时限', align: 'center'},
                {field: 'crtStepName', title: '当前流程', align: 'left', halign: 'center'},
                {
                    title: '管理',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.editDialog(\'' + row.pkId + '\')"><i class="fa fa-edit"></i>办理情况</a> ');
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.pkId + '\')"><i class="fa fa-edit"></i>查看</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function sendBack() {
        var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
        if (rows.length>1) {
            $.modal.alertWarning("请选择一条数据进行撤回");
            return;
        }
        var url = prefix + "/cmnFile/flowRollBack/" + rows;
        $.modal.open('撤回', url);
    }
    function tWFormUpdate() {
        var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
        if (rows.length>1) {
            $.modal.alertWarning("请选择一条数据进行修改");
            return;
        }
        $.modal.open('编辑工单', "/system/mTelWF/cmnFile/tWFormUpdate/" + rows);
    }
</script>
</body>
</html>